import java.util.Arrays;
public class Test4 {
    public static int search(int[] arr) {
        if (arr == null || arr.length== 0) {
            return 0;
        }
        for (int i = 0; i < arr.length-1; i++) {
            boolean result = true;
            for (int j =0; j <arr.length-1; j++) {
                if (i != j && arr[i] == arr[j]) {
                    result = false;
                }
            }
            if (result) return arr[i];
        }
        return 0;
    }

    public static void main(String[] args) {
        int[] arr = {4, 1, 2, 1, 2};
        search(arr);
        System.out.println(search(arr));
    }
}